load("//bzl:cpp_library.bzl", "cpp_library")

package(default_visibility = ["//visibility:public"])

cpp_library(
    name = "iobuf",
    srcs = [
        "Cursor.cpp",
        "IOBuf.cpp",
        "IOBufIovecBuilder.cpp",
        "IOBufQueue.cpp",
    ],
    hdrs = [
        "Cursor.h",
        "IOBuf.h",
        "IOBufIovecBuilder.h",
        "IOBufQueue.h",
    ],
    textual_hdrs = [
        "Cursor-inl.h",
    ],
    deps = [
        "//folly:conv",
        "//folly:fbstring",
        "//folly:fbvector",
        "//folly:function",
        "//folly:likely",
        "//folly:memory",
        "//folly:portability",
        "//folly:range",
        "//folly:scope_guard",
        "//folly/container:span",
        "//folly/detail:iterators",
        "//folly/hash:spooky_hash_v2",
        "//folly/lang:align",
        "//folly/lang:bits",
        "//folly/lang:checked_math",
        "//folly/lang:exception",
        "//folly/lang:hint",
        "//folly/lang:ordering",
        "//folly/memory:malloc",
        "//folly/memory:sanitize_address",
        "//folly/portability:iovec",
        "//folly/portability:sys_uio",
        "//folly/synchronization:micro_spin_lock",
        "@glog",
    ],
)

cpp_library(
    name = "global_shutdown_socket_set",
    srcs = ["GlobalShutdownSocketSet.cpp"],
    hdrs = ["GlobalShutdownSocketSet.h"],
    deps = [
        ":shutdown_socket_set",
        "//folly:singleton",
        "//folly/concurrency/memory:read_mostly_shared_ptr",
    ],
)

cpp_library(
    name = "record_io",
    srcs = [
        "RecordIO.cpp",
    ],
    hdrs = [
        "RecordIO.h",
    ],
    textual_hdrs = [
        "RecordIO-inl.h",
    ],
    deps = [
        ":iobuf",
        "//folly:exception",
        "//folly:file",
        "//folly:file_util",
        "//folly:memory",
        "//folly:portability",
        "//folly:range",
        "//folly:scope_guard",
        "//folly:string",
        "//folly/detail:iterators",
        "//folly/hash:spooky_hash_v2",
        "//folly/portability:unistd",
        "//folly/system:memory_mapping",
    ],
)

cpp_library(
    name = "shutdown_socket_set",
    srcs = ["ShutdownSocketSet.cpp"],
    hdrs = ["ShutdownSocketSet.h"],
    deps = [
        "//folly:file",
        "//folly:file_util",
        "//folly/net:net_ops",
        "//folly/net:network_socket",
        "//folly/portability:sockets",
        "//folly/synchronization:relaxed_atomic",
        "@glog",
    ],
)

cpp_library(
    name = "typed_io_buf",
    hdrs = ["TypedIOBuf.h"],
    deps = [
        ":iobuf",
        "//folly/memory:malloc",
    ],
)

cpp_library(
    name = "socket_option_map",
    srcs = [
        "SocketOptionMap.cpp",
        "SocketOptionValue.cpp",
    ],
    hdrs = [
        "SocketOptionMap.h",
        "SocketOptionValue.h",
    ],
    deps = [
        "//folly/net:network_socket",
        "//folly/portability:sockets",
    ],
)

cpp_library(
    name = "huge_pages",
    srcs = ["HugePages.cpp"],
    hdrs = ["HugePages.h"],
    deps = [
        "//folly:conv",
        "//folly:cpp_attributes",
        "//folly:format",
        "//folly:range",
        "//folly:string",
        "//folly/experimental/io:fs_util",
        "//folly/gen:base",
        "//folly/gen:file",
        "//folly/gen:string",
        "//folly/portability:unistd",
        "@boost.regex",
        "@boost.utility",
    ],
)

cpp_library(
    name = "fs_util",
    srcs = ["FsUtil.cpp"],
    hdrs = ["FsUtil.h"],
    deps = [
        "//folly:exception",
        "//folly/portability:windows",
        "@boost.filesystem",
    ],
)
